# 指定CMake版本
cmake_minimum_required(VERSION  3.10)

# 项目名称
project(exponentialdeepsky_ros)

# 指定C++版本
set(CMAKE_CXX_STANDARD 14)

# 设置编译模式为Release模式
SET(CMAKE_BUILD_TYPE "Release")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3 -Wall")

# 寻找ROS相关的包
find_package(catkin REQUIRED COMPONENTS
        message_generation
        geometry_msgs
        sensor_msgs
        roscpp
        rospy
        cv_bridge
        std_msgs
        tf
        tf_conversions
        rosbag
        message_filters
        std_srvs)

find_package(Eigen3 REQUIRED)

# 添加 OpenMP 支持
find_package(OpenMP REQUIRED)  # 查找 OpenMP 库
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")  # 添加编译选项

find_package(OpenCV REQUIRED)
#find_package(OpenCV 4.5 REQUIRED COMPONENTS core imgproc features2d)
if (OpenCV_FOUND)
    MESSAGE(STATUS "OpenCV_VERSION: " ${OpenCV_VERSION})
    MESSAGE(STATUS "OpenCV_INCLUDE_DIRS: " ${OpenCV_INCLUDE_DIRS})
    MESSAGE(STATUS "OpenCV_LIBS: " ${OpenCV_LIBS})
endif()

include_directories(
        sdk
        sdk/prot_tcp
        ${EIGEN3_INCLUDE_DIR}
        ${OpenCV_INCLUDE_DIRS}
        ${catkin_INCLUDE_DIRS})

file(GLOB ALL_SRC_LIST "sdk/*.cpp" "sdk/prot_tcp/*.cpp")
include_directories(AFTER "sdk" "sdk/prot_tcp")

list(REMOVE_ITEM ALL_SRC_LIST "sdk/main.cpp")
add_library( eds_sdk  SHARED ${ALL_SRC_LIST} )

find_package(PCL 1.2 REQUIRED COMPONENTS common io)
include_directories(${PCL_INCLUDE_DIRS})
add_definitions(${PCL_DEFINITIONS})
target_link_libraries(eds_sdk ${PCL_LIBRARIES} pthread)
add_definitions(-DPCL)
# version info
string( TIMESTAMP  COMPILE_TIME "%Y-%m-%d %H:%M:%S " )
add_definitions(-DCOMPILE_TIME="${COMPILE_TIME}")
add_definitions(-DVER="1.1")

catkin_package(CATKIN_DEPENDS roscpp rospy std_msgs message_runtime
        message_filters std_srvs tf_conversions tf cv_bridge)

add_executable(exponentialdeepsky_ros
        exponentialdeepsky_ros_node.h
        exponentialdeepsky_ros_node.cpp)
target_link_libraries(exponentialdeepsky_ros
        ${catkin_LIBRARIES}
        ${EIGEN3_LIBRARIES}
        ${OpenCV_LIBS}
        ${OpenMP_CXX_LIBRARIES}
        eds_sdk)
